#!/usr/bin/env python3
import pdfkit
import os
"""
chromium --headless --disable-gpu  --print-to-pdf-no-header --print-to-pdf=o.pdf  a.htm
"""

def HTML2PDF(name):
    path = os.path.splitext(name)[0]
    pdf = path + ".pdf"
    pdfkit.from_file(name, pdf, options = {
        'page-size'    : 'A4',
        'encoding'     : "UTF-8",
        'margin-top'   : '1in',
        'margin-left'  : '1.9in',
        'margin-right' : '1.75in',
        'margin-bottom': '1.75in',
        'orientation'  : "landscape",
    })

if __name__ == "__main__":
    HTML2PDF("tmp/a.htm")
